'use strict';

angular.module('myApp.sign', ['ngRoute'])

.config(['$routeProvider', function($routeProvider) {
    $routeProvider.when('/signin', {
        templateUrl: 'sign/signin.html',
        controller: 'SigninCtrl'
    });
}])

.controller('SigninCtrl', ['$scope', '$rootScope', '$routeParams', '$location',
    function ($scope, $rootScope, $routeParams, $location) {
        $scope.signin = function () {
            $rootScope.signin(function () {
                var done = $routeParams.done || 'index';
                $location.url(done);
            });
        };
    }
]);